<template id="app-banner">
	<div class="swiper-container">
        <div class="swiper-wrapper">
            <div class="swiper-slide" v-for="(item,index) in banners" :key="index">
                <img :src="item.src"/>
            </div>
        </div>
        <div class="swiper-button-next"></div>
        <div class="swiper-button-prev"></div>
        <div class="swiper-pagination"></div>
    </div>
</template>

<script>
import Swiper from 'swiper'
export default {
	data() {
		return {
            banners: [
                {
                    src: '/static/images/banner01.jpg'
                },
                {
                    src: '/static/images/banner02.jpg'
                },
                {
                    src: '/static/images/banner03.jpg'
                }
            ]
		}
    },
    mounted() {
        new Swiper('.swiper-container', {
            autoplay: true,
            speed: 1000,
            loop: true,
            pagination: {
                el: '.swiper-pagination',
                dynamicBullets: true,
            },
            navigation: {
                nextEl: '.swiper-button-next',
                prevEl: '.swiper-button-prev',
            },
        });
    }
}
</script>
<style>
@import 'swiper/css/swiper.min.css';

.swiper-container {
    --swiper-theme-color: #ffffff;
    width: 100%;
    /* height: 630px; */
}

.swiper-slide img {
    width: 100%;
    /* height: 100%; */
}

.swiper-button-next,
.swiper-button-prev {
    display: none;
}

.swiper-container:hover .swiper-button-prev,
.swiper-container:hover .swiper-button-next {
    display: block;
}

/** 响应式手机端样式布局 */
@media screen and (max-width: 768px) {
    .swiper-button-next,
    .swiper-button-prev {
        display: none;
    }
}
</style>